<?php get_instance()->view('common/header');?>
<style>
    .content-btn-box,.content-box{margin-top:10px;}
    .container {
        width: 100%;
    }
    .add-tag-btn{line-height: 40px;}
    .option-item {
        margin-bottom: 5px;
        position: relative;
    }
    .del-tag-btn{font-size: 14px;line-height: 36px;display: block;margin-bottom: 4px;}
    .del-tag-btn a{color: red;}
    .add-img{margin-top: 9px;float: left;left: 0;}
    .radio-list{float: left;}
    .delete-btn{position: absolute;top: 0px;right: 64px;}
    .img-box .img{width: 200px;height: 130px}
    .webuploader-container > div:nth-child(2){width: 78px !important;height: 34px !important;}
    .webuploader-pick{background: #00b7ee !important;padding: 10px 15px !important;}
</style>
<div class="page-container home">
    <?php get_instance()->view('common/sidebar');?>
    <div class="page-content-wrapper">
        <div class="page-content">
            <div class="row">
                <div class="col-md-12">
                    <!-- BEGIN PAGE TITLE & BREADCRUMB-->
                    <h3 class="page-title"> <?php echo $title ?> </h3>
                    <ul class="page-breadcrumb breadcrumb">
                        <li class="btn-group"> <a class="btn default ml_5 return" href="<?php echo getUrl('home');?>"><i class="fa fa-chevron-left"></i> 返回</a> </li>
                        <li> <i class="fa fa-home"></i> <a href="<?php echo getUrl('home');?>"> 首页  <i class="fa fa-angle-right"></i> </a></li>
                        <li><a href="javascript:void(0);"><?php echo $title ?> </a></li>
                    </ul>
                    <!-- END PAGE TITLE & BREADCRUMB-->
                </div>
            </div>
            <!--开始-->
            <div class="row">
                <div class="col-md-12">
                    <!-- BEGIN VALIDATION STATES-->
                    <div class="portlet box">
                        <div class="portlet-body form">
                            <!-- BEGIN FORM-->
                            <form action="<?php echo getUrl('config/share/save')?>" class="form-horizontal" method="post" novalidate="novalidate">

                                <div class="form-group">
                                    <label class="control-label col-md-3"> 分享页广告<span class="required">*</span></label>
                                    <div class="col-md-2 img-box">
                                        <div class="upload-img line">
                                            <div class="img-box">
                                                <img class="img images" src="<?php echo $info ? $info['share_img'] : getDefaultImg();?>">
                                                <input name="share_img" type="hidden" class="img-input" value="<?php echo $info ? $info['share_img'] : '';?>"/>
                                            </div>
                                            <div id="uploader-demo" style="margin-top:10px;margin-left: 10px;">
                                                <div id="fileList" class="uploader-list"></div>
                                                <div class="filePicker filePicker1">选择图片</div>
                                            </div>
                                            <div style="width:100%;height:10px;">
                                                <div id="progress" style="height:100%;width:0;background-color:green;">&nbsp;</div>
                                            </div>
                                        </div>
                                    </div>
                                    <script type="text/javascript">
                                        $(function () {
                                            var uploader = WebUploader.create({
                                                auto: true,
                                                server: '<?php echo getUrl('config/ads/uploadImge');?>', // 文件接收服务端
                                                pick: '.filePicker1',
                                                // 只允许选择图片文件
                                                accept: {
                                                    title: 'Images',
                                                    extensions: 'gif,jpg,jpeg,bmp,png',
                                                    mimeTypes: 'image/*'
                                                },
                                                fileVal:'Filedata'
                                            });

                                            //文件上传过程中创建进度条实时显示。
                                            uploader.on( 'uploadProgress', function( file, percentage ) {
                                                $('#progress').css( 'width', percentage * 100 + '%' );
                                            });

                                            // 文件上传成功，给item添加成功class, 用样式标记上传成功。
                                            uploader.on( 'uploadSuccess', function( file, response) {
                                                $('.images').attr('src', response._raw);
                                                $('.img-input').val(response._raw);
                                            });

                                            // 完成上传完了，成功或者失败，先删除进度条。
                                            uploader.on( 'uploadComplete', function( file ) {
                                                $('#progress').width(0);
                                            });
                                        });
                                    </script>
                                </div>
                                <div class="form-group">
                                    <label class="control-label col-md-3"> 分享步骤<span class="required">*</span></label>
                                    <div class="col-md-2 img-box">
                                        <div class="upload-img line">
                                            <div class="img-box">
                                                <img class="img images4" src="<?php echo $info ? $info['share_step'] : getDefaultImg();?>">
                                                <input name="share_step" type="hidden" class="img-input4" value="<?php echo $info ? $info['share_step'] : '';?>"/>
                                            </div>
                                            <div id="uploader-demo" style="margin-top:10px;margin-left: 10px;">
                                                <div id="fileList" class="uploader-list"></div>
                                                <div class="filePicker filePicker4">选择图片</div>
                                            </div>
                                            <div style="width:100%;height:10px;">
                                                <div id="progress progress4" style="height:100%;width:0;background-color:green;">&nbsp;</div>
                                            </div>
                                        </div>
                                    </div>
                                    <script type="text/javascript">
                                        $(function () {
                                            var uploader = WebUploader.create({
                                                auto: true,
                                                server: '<?php echo getUrl('config/ads/uploadImge');?>', // 文件接收服务端
                                                pick: '.filePicker4',
                                                // 只允许选择图片文件
                                                accept: {
                                                    title: 'Images',
                                                    extensions: 'gif,jpg,jpeg,bmp,png',
                                                    mimeTypes: 'image/*'
                                                },
                                                fileVal:'Filedata'
                                            });

                                            //文件上传过程中创建进度条实时显示。
                                            uploader.on( 'uploadProgress', function( file, percentage ) {
                                                $('#progress4').css( 'width', percentage * 100 + '%' );
                                            });

                                            // 文件上传成功，给item添加成功class, 用样式标记上传成功。
                                            uploader.on( 'uploadSuccess', function( file, response) {
                                                $('.images4').attr('src', response._raw);
                                                $('.img-input4').val(response._raw);
                                            });

                                            // 完成上传完了，成功或者失败，先删除进度条。
                                            uploader.on( 'uploadComplete', function( file ) {
                                                $('#progress4').width(0);
                                            });
                                        });
                                    </script>
                                </div>
                                <div class="form-group">
                                    <label class="control-label col-md-3"> 注册页广告<span class="required">*</span></label>
                                    <div class="col-md-2 img-box">
                                        <div class="upload-img line">
                                            <div class="img-box">
                                                <img class="img images2" src="<?php echo $info ? $info['register_img'] : getDefaultImg();?>">
                                                <input name="register_img" type="hidden" class="img-input2" value="<?php echo $info ? $info['register_img'] : '';?>"/>
                                            </div>
                                            <div id="uploader-demo" style="margin-top:10px;margin-left: 10px;">
                                                <div id="fileList" class="uploader-list"></div>
                                                <div class="filePicker filePicker2">选择图片</div>
                                            </div>
                                            <div style="width:100%;height:10px;">
                                                <div id="progress2" style="height:100%;width:0;background-color:green;">&nbsp;</div>
                                            </div>
                                        </div>
                                    </div>
                                    <script type="text/javascript">
                                        $(function () {
                                            var uploader = WebUploader.create({
                                                auto: true,
                                                server: '<?php echo getUrl('config/ads/uploadImge');?>', // 文件接收服务端
                                                pick: '.filePicker2',
                                                // 只允许选择图片文件
                                                accept: {
                                                    title: 'Images',
                                                    extensions: 'gif,jpg,jpeg,bmp,png',
                                                    mimeTypes: 'image/*'
                                                },
                                                fileVal:'Filedata'
                                            });

                                            //文件上传过程中创建进度条实时显示。
                                            uploader.on( 'uploadProgress', function( file, percentage ) {
                                                $('#progress2').css( 'width', percentage * 100 + '%' );
                                            });

                                            // 文件上传成功，给item添加成功class, 用样式标记上传成功。
                                            uploader.on( 'uploadSuccess', function( file, response) {
                                                $('.images2').attr('src', response._raw);
                                                $('.img-input2').val(response._raw);
                                            });

                                            // 完成上传完了，成功或者失败，先删除进度条。
                                            uploader.on( 'uploadComplete', function( file ) {
                                                $('#progress2').width(0);
                                            });
                                        });
                                    </script>
                                </div>
                                <div class="form-group">
                                    <label class="control-label col-md-3"> 下载页广告<span class="required">*</span></label>
                                    <div class="col-md-2 img-box">
                                        <div class="upload-img line">
                                            <div class="img-box">
                                                <img class="img images3" src="<?php echo $info ? $info['down_img'] : getDefaultImg();?>">
                                                <input name="down_img" type="hidden" class="img-input3" value="<?php echo $info ? $info['down_img'] : '';?>"/>
                                            </div>
                                            <div id="uploader-demo" style="margin-top:10px;margin-left: 10px;">
                                                <div id="fileList" class="uploader-list"></div>
                                                <div class="filePicker filePicker3">选择图片</div>
                                            </div>
                                            <div style="width:100%;height:10px;">
                                                <div id="progress3" style="height:100%;width:0;background-color:green;">&nbsp;</div>
                                            </div>
                                        </div>
                                    </div>
                                    <script type="text/javascript">
                                        $(function () {
                                            var uploader = WebUploader.create({
                                                auto: true,
                                                server: '<?php echo getUrl('config/ads/uploadImge');?>', // 文件接收服务端
                                                pick: '.filePicker3',
                                                // 只允许选择图片文件
                                                accept: {
                                                    title: 'Images',
                                                    extensions: 'gif,jpg,jpeg,bmp,png',
                                                    mimeTypes: 'image/*'
                                                },
                                                fileVal:'Filedata'
                                            });

                                            //文件上传过程中创建进度条实时显示。
                                            uploader.on( 'uploadProgress', function( file, percentage ) {
                                                $('#progress3').css( 'width', percentage * 100 + '%' );
                                            });

                                            // 文件上传成功，给item添加成功class, 用样式标记上传成功。
                                            uploader.on( 'uploadSuccess', function( file, response) {
                                                $('.images3').attr('src', response._raw);
                                                $('.img-input3').val(response._raw);
                                            });

                                            // 完成上传完了，成功或者失败，先删除进度条。
                                            uploader.on( 'uploadComplete', function( file ) {
                                                $('#progress3').width(0);
                                            });
                                        });
                                    </script>
                                </div>
                                <div class="form-body">
                                    <div class="form-group">
                                        <label class="control-label col-md-3">活动规则<span class="required">*</span></label>
                                        <div class="col-md-6" >
                                            <script id="content" name="content" type="text/plain" ><?php echo  ! empty($info['content']) ? $info['content'] : ''; ?></script>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-actions fluid hide" style="position:fixed;z-index:10000;bottom:0px">
                                    <div class="col-md-offset-3 col-md-8">
                                        <button class="btn green submit-btn" type="submit"><i class="fa fa-save"></i> 保存</button>
                                    </div>
                                </div>
                                <script type="text/javascript">
                                    $(function(){
                                        setTimeout("$('.form-actions').width($('.form-body').innerWidth()).removeClass('hide');", '500');
                                        window.onresize = function(){
                                            $('.form-actions').width($('.form-body').innerWidth());
                                        }
                                    });
                                </script>
                            </form>
                            <!-- END FORM-->
                        </div>
                    </div>
                    <!-- END VALIDATION STATES-->
                </div>
            </div>
            <!--结束-->
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function(){

        $.e_validate.init('.form-horizontal',{});
        UE.getEditor('content',{initialFrameWidth:'800',initialFrameHeight:'500',autoHeightEnabled:false,serverUrl:'<?php echo getUrl('config/share/editor');?>'});
    });
</script>
</body>
</html>